//
//  BaseViewController.m
//  moment1
//
//  Created by dllo on 15/12/21.
//  Copyright © 2015年 庞泽人. All rights reserved.
//

#import "BaseViewController.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor colorWithRed:arc4random() % 256 / 255.0 green:arc4random() % 256 / 255.0 blue:arc4random() % 256 / 255.0 alpha:1.0];
    
    
    
    UIView *aView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
    //aView.backgroundColor = [UIColor orangeColor];
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 25, 25)];
    imageView.image = [UIImage imageNamed:@"iconfont-caidan.png"];
    imageView.userInteractionEnabled = YES;
    [aView addSubview:imageView];
    
    UIView *centerView = [[UIView alloc] initWithFrame:CGRectMake(26, 2, 1, 21)];
    centerView.backgroundColor = [UIColor grayColor];
    [aView addSubview:centerView];
    
#pragma mark 设置每页左上角的标题    
    self.headNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(31, 0, 100 - 31, 25)];
    [aView addSubview:self.headNameLabel];
    //self.headNameLabel.backgroundColor = [UIColor cyanColor];
    self.headNameLabel.font = [UIFont systemFontOfSize:15];
    
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:aView];
    self.navigationItem.leftBarButtonItem.tintColor = [UIColor whiteColor];
    
    UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGRaction:)];
    [imageView addGestureRecognizer:tapGR];
}


#pragma mark- 抽屉按钮方法
- (void)tapGRaction:(UITapGestureRecognizer *)sender
{
    AppDelegate *tempAppDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    if (tempAppDelegate.leftSlideVC.closed) {
        [tempAppDelegate.leftSlideVC openLeftView];
    } else {
        [tempAppDelegate.leftSlideVC closeLeftView];
    }
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}



@end